﻿using System;
using System.Windows.Forms;
using Microsoft.VisualBasic.ApplicationServices;

namespace VietNamKey
{
    internal class SingleInstance : WindowsFormsApplicationBase
    {
        private SingleInstance()
        {
            base.IsSingleInstance = true;
        }

        public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
        {
            var instance = new SingleInstance
                {
                    MainForm = f
                };
            instance.StartupNextInstance += startupHandler;
            instance.Run(Environment.GetCommandLineArgs());
        }
    }
}